<template>
	<view class="navBar">
		<view style="position: relative;">
			<u-icon name="list" color="#343434" size="44" @click="showAsideMenu"></u-icon>
			<u-badge size="mini" type="error" count="100" :offset="[-12,-34]"></u-badge>
		</view>
		<view :class="['item', isActive==index?'active':'']" v-for="(item,index) in navList" :key='item.text' @click="toPath(item.path)">{{item.text}}</view>
		<u-icon name="search" color="#343434" size="44" @click="toPath('/pages/search/search')"></u-icon>
		<!-- 侧边栏菜单 -->
		<u-popup v-model="show" width='700'>
			<view class="asideMenu">
				<!-- 会员中心 -->
				<view class="vip">
					<view class="vip-top">
						<view class="vip-logo">
							<view class="vip-logo-img">
								<u-image width="50%" mode="widthFix" src="http://123.56.1.202/xxch/images/vip.png"></u-image>
							</view>
							<view class="vip-logo-text">
								已过期298天，山野烂漫等你回来
							</view>
						</view>
						<u-button size="mini" class="vip-btn" :plain="true" shape="circle">会员中心</u-button>
					</view>
					<view class="view-bottom">
						黑胶VIP买1得8，1折抢购开启！
						<u-image width="8%" mode="widthFix" src="http://123.56.1.202/xxch/images/1zhe.png" class="view-bottom-img"></u-image>
					</view>
				</view>
				<!-- 云贝中心  消息中心 -->
				<view class="ybAndMessage">
					<view class="ybzx">
						<navigator :url="'/pages/'">
							<u-image width="25%" mode="widthFix" src="http://123.56.1.202/xxch/images/yunbei.png" class="view-bottom-img"></u-image>
							<view style="margin-left: 10rpx;">
								<view style="margin-bottom: 10rpx;">
									云贝中心
								</view>
								<u-button size="mini" type="error" class="vip-btn" :plain="true" shape="circle">签到</u-button>
							</view>
						</navigator>
					</view>
					<view class="xxzx">
						<navigator :url="'/pages/'">
							<u-image width="25%" mode="widthFix" src="http://123.56.1.202/xxch/images/xiaoxi.png" class="view-bottom-img"></u-image>
							<view style="margin-left: 10rpx;">
								<view style="margin-bottom: 10rpx; position: relative;">
									消息中心
									<u-badge size="mini" type="error" count="100" :offset="[10,-34]"></u-badge>
								</view>
								<view style="font-size: 10px;color: #d3d3d3;font-weight: normal;">
									有关注新歌发布
								</view>
							</view>
						</navigator>
					</view>
				</view>
				<!-- 创作者中心 -->
				<view class="ybAndMessage czzzx">
					<navigator :url="'/pages/'">
						<view class="czzzx-left">
							<u-image class="czzzx-left-img" width="15%" mode="widthFix" src="http://123.56.1.202/xxch/images/czzzx.png"></u-image>
							创作者中心
						</view>
						<view class="czzzx-right">
							<u-image width="25%" mode="widthFix" src="http://123.56.1.202/xxch/images/yjt.png" class="view-bottom-img"></u-image>
						</view>
					</navigator>
				</view>
				<!-- 音乐服务 -->
				<view class="ybAndMessage musicServe">
					<!-- 标题 -->
					<view class="musicServe-title">
						音乐服务
					</view>
					<view class="musicServe-item" v-for="(item,index) in musicServeList" :key='index'>
						<navigator :url="'/pages/'">
							<u-image class="musicServe-item-img" width="6%" mode="widthFix" :src="item.img"></u-image>
							<text>{{item.text}}</text>
						</navigator>
					</view>
				</view>
				<!-- 其他 -->
				<view class="ybAndMessage musicServe qita">
					<!-- 标题 -->
					<view class="musicServe-title">
						其他
					</view>
					<view class="musicServe-item" v-for="(item,index) in qitaList" :key='index'>
						<navigator :url="'/pages/'">
							<u-image class="musicServe-item-img" width="6%" mode="widthFix" :src="item.img"></u-image>
							<text>{{item.text}}</text>
						</navigator>
					</view>
				</view>
				<!-- 订单 -->
				<view class="ybAndMessage musicServe order">
					<view class="musicServe-item" v-for="(item,index) in orderList" :key='index'>
						<navigator :url="'/pages/'">
							<u-image class="musicServe-item-img" width="6%" mode="widthFix" :src="item.img"></u-image>
							<text>{{item.text}}</text>
						</navigator>
					</view>
				</view>
				<!-- 底部部分 -->
				<view class="footer">
					<view class="footer-item">
						<navigator :url="'/pages/'">
							<u-image class="footer-item-img" width="16%" mode="widthFix" src='http://123.56.1.202/xxch/images/yjms.png'></u-image>
							<text>夜间模式</text>
						</navigator>
					</view>
					<view class="footer-item">
						<navigator :url="'/pages/'">
							<u-image class="footer-item-img" width="16%" mode="widthFix" src='http://123.56.1.202/xxch/images/sz.png'></u-image>
							<text>设置</text>
						</navigator>
					</view>
					<view class="footer-item">
						<navigator :url="'/pages/'">
							<u-image class="footer-item-img" width="16%" mode="widthFix" src='http://123.56.1.202/xxch/images/tc.png'></u-image>
							<text>退出</text>
						</navigator>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		props: {
			isActive: {
				type: Number,
				default: 1
			}
		},
		data() {
			return {
				show: false,
				navList: [{
					text: '我的',
					path: '/pages/my/my'
				}, {
					text: '发现',
					path: '/pages/look/look'
				}, {
					text: '云村',
					path: '/pages/shequ/shequ'
				}, {
					text: '视频',
					path: '/pages/video/video'
				}],
				// 音乐服务列表
				musicServeList: [{
						img: require('@/static/images/tgsq.png'),
						text: '听歌识曲'
					},
					{
						img: require('@/static/images/piao.png'),
						text: '云村有票'
					},
					{
						img: require('@/static/images/cart.png'),
						text: '商城'
					},
					{
						img: require('@/static/images/game.png'),
						text: '游戏专区'
					},
					{
						img: require('@/static/images/cailing.png'),
						text: '口袋彩铃'
					}
				],
				// 其他列表项
				qitaList: [{
						img: require('@/static/images/gxzb.png'),
						text: '个性装扮'
					},
					{
						img: require('@/static/images/nz.png'),
						text: '定时关闭'
					},
					{
						img: require('@/static/images/sys.png'),
						text: '扫一扫'
					},
					{
						img: require('@/static/images/btbc.png'),
						text: '边听边存'
					},
					{
						img: require('@/static/images/mll.png'),
						text: '在线听歌免流量'
					},
					{
						img: require('@/static/images/hmd.png'),
						text: '音乐黑名单'
					},
					{
						img: require('@/static/images/qsnms.png'),
						text: '青少年模式'
					},
					{
						img: require('@/static/images/yynz.png'),
						text: '音乐闹钟'
					},
				],
				// 订单
				orderList: [{
						img: require('@/static/images/dd.png'),
						text: '我的订单'
					},
					{
						img: require('@/static/images/yhq.png'),
						text: '优惠券'
					},
					{
						img: require('@/static/images/help.png'),
						text: '帮助与反馈'
					},
					{
						img: require('@/static/images/about.png'),
						text: '关于'
					},
				]
			}
		},
		methods: {
			showAsideMenu() {
				this.show = true;
			},
			toPath(path) {
				uni.reLaunch({
					url: path
				});
			},
		}
	}
</script>

<style scoped lang="scss">
	.navBar {
		display: flex;
		justify-content: space-between;
		align-items: center;
		position: fixed;
		top: -20rpx;
		left: 30rpx;
		z-index: 100;
		width: calc(100% - 60rpx);
		height: 180rpx;
		padding-top: 100rpx;
		background-color: #f8f7f7;
		
		.item {
			width: 100rpx;
			text-align: center;
			font-size: 34rpx;
			color: #828282;
		}

		.active {
			font-weight: 900;
			color: black;
			font-size: 36rpx;
		}
	}

	// 侧边栏菜单
	.asideMenu {
		padding: 40rpx;
		padding-top: 100rpx;
		background-color: #f7f7f7;
		position: relative;

		// 黑胶vip
		.vip {
			height: 200rpx;
			background-image: linear-gradient(120deg, #8a8a8a 0%, #a9a9a9 100%);
			border-radius: 30rpx;

			.vip-top {
				width: 90%;
				height: 60%;
				margin: auto;
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-bottom: 1px solid #aaaaaa;

				.vip-logo-text {
					font-size: 22rpx;
					color: #d3d3d3;
				}

				.vip-btn {
					margin: 0;
				}
			}

			.view-bottom {
				width: 90%;
				margin: auto;
				font-size: 22rpx;
				color: #d3d3d3;
				line-height: 60rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.view-bottom-img {
					margin-top: 20rpx;
				}
			}
		}

		// 云贝中心、消息中心
		.ybAndMessage {
			display: flex;
			justify-content: space-between;
			align-items: center;
			background-color: #fff;
			margin-top: 30rpx;
			border-radius: 20rpx;
			height: 140rpx;
			text-align: center;

			.ybzx {
				width: 50%;
				height: 100%;
				display: flex;
				align-items: center;
				justify-content: center;
				color: #333333;
				font-weight: bold;
				position: relative;

				navigator {
					width: 100%;
					height: 100%;
					display: flex;
					justify-content: center;
					align-items: center;
				}
			}

			.ybzx::after {
				content: '';
				height: 80%;
				position: absolute;
				right: 0;
				border-right: 1px solid #e6e6e6;
			}


			.xxzx {
				width: 50%;
				height: 100%;
				display: flex;
				align-items: center;
				justify-content: center;
				color: #333333;
				font-weight: bold;

				navigator {
					width: 100%;
					height: 100%;
					display: flex;
					justify-content: center;
					align-items: center;
				}
			}
		}

		// 创作者中心
		.czzzx {
			navigator {
				width: 100%;
				height: 100%;
				display: flex;
			}

			.czzzx-left {
				width: 80%;
				height: 100%;
				display: flex;
				justify-content: flex-start;
				align-items: center;
				color: #333333;
				font-weight: bold;

				.czzzx-left-img {
					margin-left: 60rpx;
					margin-right: 16rpx;
					margin-top: 10rpx;
				}
			}

			.czzzx-right {
				width: 20%;
				display: flex;
				justify-content: flex-end;
				align-items: center;
				margin-right: 20rpx;
			}
		}

		// 音乐服务
		.musicServe {
			flex-wrap: wrap;
			align-items: flex-start;
			justify-content: flex-start;
			height: auto;

			.musicServe-title {
				width: 100%;
				line-height: 70rpx;
				font-size: 28rpx;
				color: #999999;
				border-bottom: 1px solid #f3f3f3;
				text-align: left;
				text-indent: 2em;
			}

			.musicServe-item {
				width: 100%;
				display: flex;
				align-items: center;
				margin: 20rpx 0rpx;

				navigator {
					width: 100%;
					display: flex;
				}

				.musicServe-item-img {
					margin-left: 60rpx;
					margin-right: 30rpx;
				}
			}
		}

		// 我的订单
		.order {
			margin-bottom: 110rpx;
		}


		// 页脚部分
		.footer {
			width: 100%;
			height: 120rpx;
			background-color: #fff;
			display: flex;
			justify-content: space-around;
			align-items: center;
			margin-top: 40rpx;
			position: absolute;
			left: 0;
			bottom: 0;

			.footer-item {
				display: flex;
				justify-content: center;
				align-items: center;
				width: 33.3%;
				height: 100%;

				navigator {
					width: 100%;
					height: 100%;
					display: flex;
					justify-content: center;
					align-items: center;
				}

				.footer-item-img {
					margin-right: 20rpx;
					margin-top: 10rpx;
				}
			}
		}

	}
</style>
